package cn.hackcloud.concurrency.activeobject;

public class OrderServiceFactory {
    private final static ActiveMessageQueue MESSAGE_QUEUE = new ActiveMessageQueue();

    private OrderServiceFactory() {

    }

    public static OrderService toActiveObject(OrderService orderService) {
        return new OrderServiceProxy(orderService, MESSAGE_QUEUE);
    }


    public static void main(String[] args) throws InterruptedException {
        OrderService orderService = OrderServiceFactory.toActiveObject(new OrderServiceImpl());
        orderService.order("hello", 10000);
        System.out.println("Return immediately.");
        Thread.currentThread().join();
    }
}
